package top.kaoshanji.p2ch15c;

/**
 * 代码清单-p2ch15c-171页e：具体的Command类1
 * @author kaoshanji
 * ^_^
 * create time 2025/3/23 17:45
 */
public class ConcreteCommand1 extends Command {

    // 对哪个 Receiver 类进行命令处理
    private Receiver receiver;

    // 构造函数传递接收者
    public ConcreteCommand1(Receiver receiver) {
        this.receiver = receiver;
    }

    // 必须实现一个命令
    @Override
    public void execute() {
        // 业务处理
        this.receiver.doSomething();
    }
}
